<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="p" uri="http://primefaces.prime.com.tr/ui"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view>
	<html xmlns="http://www.w3.org/1999/xhtml"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:p="http://primefaces.prime.com.tr/ui">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><h:outputText
		value="#{message.mainHeader} - #{message.userBookManagingPanelHeader}" /></title>

	<link rel="stylesheet" type="text/css" href="../style.css" />
	<style type="text/css">
.matrix {
	font-family: Lucida Console, Courier, Monotype;
	font-size: 15pt;
	text-align: center;
	width: 12px;
	padding: 0px;
	margin: 0px;
}
</style>
	<script src="../matrix.js" type="text/javascript"></script>

	<p:resources />

	</head>
	<body>
	<center><h:panelGrid width="900" border="0" columns="2">
		<h:panelGroup style="width: %70;">
			<h:graphicImage value="../images/dunya.png"></h:graphicImage>

		</h:panelGroup>
		<h:panelGroup>
			<div id="matrix">SANAL KITAPLIK</div>
		</h:panelGroup>
	</h:panelGrid> <h:panelGrid width="900" border="0" columns="1">
		<h:panelGroup>
			<h:form>
				<p:menubar>
					<p:submenu label="Ana Sayfa">
					</p:submenu>
					<p:submenu label="Kitaplar">
						<p:menuitem value="Çok Satanlar"></p:menuitem>
						<p:menuitem value="Yeni Eklenenler"></p:menuitem>
						<p:menuitem value="Acil olanlar"></p:menuitem>
					</p:submenu>
					<p:submenu label="Ders Notları">
						<p:menuitem value="Çok Satanlar"></p:menuitem>
						<p:menuitem value="Yeni Eklenenler"></p:menuitem>
					</p:submenu>
					<p:submenu label="Kullanıcı Görüşleri">
						<p:menuitem value="ddde"></p:menuitem>
					</p:submenu>
				</p:menubar>
			</h:form>
		</h:panelGroup>
	</h:panelGrid> <h:panelGrid columns="2" cellpadding="0" cellspacing="0"
		style="width:100%;text-align:center;">
		<h:outputLabel value="#{message.mainTitle}"
			style="background-image:url('/images/gcc.png');" />
		<h:outputLabel value="#{message.mainTitle}" />
	</h:panelGrid> <h:panelGrid width="900">
		<p:tabView>
			<p:tab title="#{message.bookGallery}">
				<center><p:carousel
					value="#{UserManagerBean.bookManager.books}" var="book"
					itemStyleClass="bookItem">
					<h:panelGrid columns="1" style="width:200px;" cellpadding="5">
						<p:graphicImage value="#{book.cover}" />
						<h:outputText value="#{book.title}" />
						<h:outputText value="#{book.authorNames}" escape="false"/>
					</h:panelGrid>
				</p:carousel></center>
			</p:tab>
			<p:tab title="#{message.editBooks}">
				<h:panelGrid columns="2">
					<h:form id="editBooksForm">
						<h:panelGrid columns="1">
							<p:dataTable value="#{UserManagerBean.bookManager.books}"
								var="book">
								<p:column>
									<f:facet name="header">
										<h:outputText value="Title" />
									</f:facet>
									<h:outputText value="#{book.title}" />
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="Author" />
									</f:facet>
									<h:outputText value="#{book.authorNames}" escape="false"/>
								</p:column>
								<p:column>
									<f:facet name="header">
										<h:outputText value="Operation" />
									</f:facet>
									<p:commandLink value="Remove" update="editBooksForm"
										actionListener="#{book.remove}" />
									<h:outputText value="/" />
									<p:commandLink value="Edit" update="bookManageForm"
										actionListener="#{book.requestEdit}" />
								</p:column>
							</p:dataTable>
							<p:commandButton value="#{message.addNewBook}"
								actionListener="#{UserManagerBean.bookManager.addNewBookActivate}"
								update="bookManageForm" />
						</h:panelGrid>
					</h:form>
					<h:form id="bookManageForm">
						<p:panel id="bookManageFormPanel"
							visible="#{UserManagerBean.bookManager.manageBookFormActive == true}">
							<h:panelGroup
								rendered="#{UserManagerBean.bookManager.addNewBookActive == true}">
								<h:panelGrid columns="2">
									<h:outputLabel value="Kitap Adı:" />
									<h:inputText
										value="#{UserManagerBean.bookManager.addingBook.title}" />
									<h:outputLabel value="Yazar:" />
									<h:panelGrid columns="2" cellpadding="0" cellspacing="0" border="0">
										<h:inputText id="authorInput"
											value="#{UserManagerBean.bookManager.addingBook.tmpAuthor}" />
										<p:commandButton value="Ekle"
											actionListener="#{UserManagerBean.bookManager.addingBook.addAuthorListener}"
											update="authorList, authorInput" />
									</h:panelGrid>
									<h:outputText value="Eklenen Yazarlar:" />
									<h:panelGroup id="authorList">
										<h:outputText value="Henüz hiçbir yazar eklemediniz"
										rendered="#{UserManagerBean.bookManager.addingBook.authorListEmpty}"/>
										<h:outputText
											value="#{UserManagerBean.bookManager.addingBook.authorNames}"
											escape="false"
											rendered="#{!UserManagerBean.bookManager.addingBook.authorListEmpty}"/>
									</h:panelGroup>
									<h:outputLabel value="Tür:"/>
									<h:selectOneMenu value="#{UserManagerBean.bookManager.addingBook.genre}"
										style="width:100px;">
										<f:selectItems value="#{UserManagerBean.bookManager.genres}"/>
									</h:selectOneMenu>
									<h:outputLabel value="Açıklama:"/>
									<h:inputTextarea value="#{UserManagerBean.bookManager.addingBook.description}"/>
									<h:outputText/>
									<p:commandButton value="Kitabı Ekle"/>
								</h:panelGrid>
							</h:panelGroup>
							<h:panelGroup
								rendered="#{UserManagerBean.bookManager.editBookActive == true}">
								<h:outputText
									value="Burada #{UserManagerBean.bookManager.editingBook.title} kitabının bilgileri guncellenecek" />
							</h:panelGroup>
						</p:panel>
					</h:form>
				</h:panelGrid>
			</p:tab>
		</p:tabView>
	</h:panelGrid></center>
	</body>
	</html>
</f:view>